<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="con" style="border:5px solid red ;width:400px;height:300px;padding:30px">
        <img src="1.png" style="width:100%"/>

    </div>
</body>
<script>
    var con=document.getElementById("con");
    con.onmouseover=function(){
        this.style.border="2px solid blue";
    }
    //鼠标摁下时，触发该事件onnmousedown
    con.onmousedown=function(){
        this.style.backgroundColor="pink";
    }
    //鼠标摁下松开时，触发onmouseup
    con.onmouseup=function(){
        this.style.backgroundColor="white";
    }
    con.onclick=function(){
        console.log(this.style.height,this.style.width);
    }
</script>
</html>